package com.silence.thread.gift;

import java.util.LinkedList;

public class giftTest {
    public static void main(String[] args) throws Exception {
        // 要求：总共100份礼物，小明和小明同时拿了往外分发，分发到还剩下10份的时候停止，最后输出小明和小红各自分发的数目
        LinkedList<String> gift_list = new LinkedList<>();
        for (int i = 1; i <= 100; i++) {
            gift_list.add("gift"+i);
        }
        System.out.println(gift_list);

        MyThread_gift xm = new MyThread_gift(gift_list,"小明");
        MyThread_gift xh = new MyThread_gift(gift_list,"小红");
        xm.start();
        xh.start();

        xh.join();
        xm.join();
        System.out.println(xm.getSum());
        System.out.println(xh.getSum());


    }
}
